﻿// See https://aka.ms/new-console-template for more information
using GbopSdk;

//GET方法调用示例
GbopRequest requestItem2 = new GbopRequest()
{
    AK = "21ebe34e53495431363138",
    HostUrl = "http://geely-uc.api-sit.test.geely.svc",
    Method = GbopHttpMethod.GET,
    PATH = "/uc/v1/tenant/org/parent/allOrg",
    SK = "12054138-7793-4e1a-abda-a473dbdeda44"
};

requestItem2.Querys.Add(new QueryItem() { QueryKey = "tenantOrgId", QueryValue = "13731" });
requestItem2.Querys.Add(new QueryItem() { QueryKey = "ssoKeyId", QueryValue = "f39a289f5a081b57cacee2159db98d8fxaJKtX6nTqE" });

GbopResponse result2 = GbopHelper.ExeHttp(requestItem2);

Console.WriteLine(result2);
Console.WriteLine("======================================================================");

//GET方法调用示例
GbopRequest requestItem1 = new GbopRequest()
{
    AK = "850ab7bd53495431303138",
    HostUrl = "http://ma.api-sit.test.geely.svc",
    Method = GbopHttpMethod.GET,
    PATH = "/api/v1/distribution/templates/templateId",
    SK = "10d9c037-dd82-4eb5-888f-fe4982f306f8"
};

requestItem1.Querys.Add(new QueryItem() { QueryKey = "templateId", QueryValue = "1" });
requestItem1.Querys.Add(new QueryItem() { QueryKey = "tenantId", QueryValue = "123456" });

GbopResponse result1 = GbopHelper.ExeHttp(requestItem1);

Console.WriteLine(result1);
Console.WriteLine("======================================================================");

////POST方法调用示例
//GbopRequest requestItem2 = new GbopRequest();
//requestItem2.AK = "f97a28b044455631303031";
//requestItem2.HostUrl = "http://hello.api-dev.test.geely.com";
//requestItem2.Method = GbopHttpMethod.POST;
//requestItem2.PATH = "/api/v1/demo";
//requestItem2.SK = "04a22ba1-6529-41d5-8213-d8e5441bcc63";

//requestItem2.Bodys.Add(new BodyItem() { BodyKey = "age", BodyValue = "45" });
//requestItem2.Bodys.Add(new BodyItem() { BodyKey = "name", BodyValue = "123" });
//requestItem2.Bodys.Add(new BodyItem() { BodyKey = "description", BodyValue = "23" });
//requestItem2.Bodys.Add(new BodyItem() { BodyKey = "id", BodyValue = "11" });

//GbopResponse result2 = GbopHelper.ExeHttp(requestItem2);

//Console.WriteLine(result2);


//using Newtonsoft.Json;

//dynamic jsonResponse = JsonConvert.DeserializeObject("{\"message\":[\"Hi\",\"C\"]}");
//jsonResponse.Works = true;
//Console.WriteLine(jsonResponse.message); // Hi
//Console.WriteLine(jsonResponse.Works); // True
//Console.WriteLine(JsonConvert.SerializeObject(jsonResponse)); // {"message":"Hi","Works":true}
//Console.Read();